import { http } from '@/services/request';
import { prefix, tableNameProject } from './config';
// 添加项目
interface AddProjectParam {
	name: string;
	code: string;
	_id?: string;
}
export const addProject = (param: AddProjectParam) => http.post(`${prefix}/addValue/${tableNameProject}`, param);
// 编辑项目
export const updateProject = (param: AddProjectParam) => http.post(`${prefix}/updateValue/${tableNameProject}`, param);
// 删除项目
export const deleteProject = (param: string[]) => http.post(`${prefix}/deleteValueById/${tableNameProject}`, param);

// 查询项目
interface QueryProjectParam {
	name?: string;
}
export interface ProjectItem {
	_id: string;
	name: string;
	code: string;
	createTime?: number;
}
export const queryProject = (param?: QueryProjectParam): Promise<ProjectItem[]> => {
	return http.post(`${prefix}/queryValue/${tableNameProject}`, param)
};
